<html>
<head><meta charset="utf-8"><title>zlib · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html">zlib</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="242963301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242963301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242963301">(Jun 17 2021 at 01:21)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> What's the status of using zlib-ng with libgit2?  Would it be safe for cargo to start using that?  I was doing a little profiling, and the performance of the static zlib isn't so great, and zlib-ng seemed to be a fair bit better.</p>



<a name="242968552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242968552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242968552">(Jun 17 2021 at 03:24)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> It works quite well. Long-term, I really want to rework it so that it uses zlib-ng natively rather than in zlib-compat mode, so that it doesn't use the same symbol names as zlib; that would make it a little cleaner to use. As it stands, you have to make sure anything that links to zlib is using zlib-ng-compat, so that means setting the appropriate features on both git2 and curl.</p>



<a name="242968581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242968581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242968581">(Jun 17 2021 at 03:25)</a>:</h4>
<p>I'm using it in production with libgit2 and git2-rs, and it works quite well; no issues whatsoever.</p>



<a name="242968650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242968650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242968650">(Jun 17 2021 at 03:26)</a>:</h4>
<p>However, Linux distributions are still going to want to build with stock zlib, and some users of the cargo crate might too, so we'll need to have features controlling it.</p>



<a name="242968758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242968758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242968758">(Jun 17 2021 at 03:28)</a>:</h4>
<p>Sounds good.  I might investigate switching things over, hopefully it won't be too much of a hassle.</p>
<p>And, BTW, do you happen to know if improving the performance of SHA1 in libgit2 is feasible?  I was doing some testing, and the collision-detection implementation is substantially slower than OpenSSL.  That seems like it might be harder/riskier to change, but was curious if you had looked at that.</p>



<a name="242968775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242968775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242968775">(Jun 17 2021 at 03:29)</a>:</h4>
<p>It's possible to disable collision detection, but that's a risk.</p>



<a name="242968786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242968786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242968786">(Jun 17 2021 at 03:29)</a>:</h4>
<p>I wasn't aware of it being <em>that</em> much slower; I had the impression that the code was derived from the same code that's used for sha1 in OpenSSL.</p>



<a name="242968788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/242968788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#242968788">(Jun 17 2021 at 03:29)</a>:</h4>
<p>(insofar as the faster code from git was later added to OpenSSL)</p>



<a name="243098816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/zlib/near/243098816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/zlib.html#243098816">(Jun 17 2021 at 23:30)</a>:</h4>
<p>On my system, the OpenSSL SHA1 implementation uses <a href="https://github.com/openssl/openssl/blob/52e6c77ebc25590ac894ce67d83a02da07c6f01f/crypto/sha/asm/sha1-586.pl#L1118-L1199">this assembly code</a> implementation that is optimized for AVX, whereas the libgit2 implementation is pure-C.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>